
<blockquote class="layui-elem-quote explain" id="">
	站点配置
</blockquote>
<div class="layui-form">
	<div class="layui-form-item">
		<label class="layui-form-label">管理账号</label>
		<div class="layui-input-block">
			<input type="text" id="user" lay-verify="required" placeholder="请输入管理账号" autocomplete="off" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">管理密码</label>
		<div class="layui-input-block">
			<input type="text" id="pass" lay-verify="required" placeholder="请输入管理密码" autocomplete="off" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">v免签配置</label>
		<div class="layui-input-block">
			<input type="text" id="vmq" lay-verify="required" placeholder="请输入v免签配置" autocomplete="off" class="layui-input">
		</div>
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">站点名称</label>
		<div class="layui-input-block">
			<input type="text" id="name" lay-verify="required" placeholder="请输入站点名称" autocomplete="off" class="layui-input">
		</div>
	</div>


	<div class="layui-form-item">
		<label class="layui-form-label">站点公告</label>
		<div class="layui-input-block">
			<textarea id="gg" style="display: none;"></textarea>
		</div>
	</div>




</div>

<div style="text-align: right">
	<button class="layui-btn" lay-submit lay-filter="formDemo" onclick="sub()">保存</button>

</div>



<script>


    function sub() {
        var name =$('#name').val();
        if (name == ""){
            layer.msg("请输入站点名称");
            return;
        }


		var user =$('#user').val();
		if (user == ""){
			layer.msg("请输入管理账号");
			return;
		}

		var pass =$('#pass').val();
        if (pass == ""){
            layer.msg("请输入管理密码");
            return;
        }
		var vmq =$('#vmq').val();
		if (vmq == ""){
			layer.msg("请输入v免签配置");
			return;
		}



        layedit.sync(layeditindex);
        var gg =$('#gg').val();


		var post = "name="+name+"&gg="+encodeURIComponent(gg)+"&user="+user+"&pass="+pass+"&vmq="+vmq;

        $.post("admin/saveSetting",post,function (data) {
            layer.msg(data.msg);
        });
    }
	var layedit,layeditindex;

    layui.use(['layedit',"form"], function(){

        layedit = layui.layedit;



        $.post("admin/getSetting",function (data) {
            $('#name').val(data.data.name);
            $('#kf').val(data.data.kf);
            $('#qun').val(data.data.qun);
            $('#gg').val(data.data.gg);
            $('#user').val(data.data.user);
			$('#pass').val(data.data.pass);
			$('#vmq').val(data.data.vmq);

            layeditindex = layedit.build('gg',{
                tool: [
                    'strong' //加粗
                    ,'italic' //斜体
                    ,'underline' //下划线
                    ,'del' //删除线

                    ,'|' //分割线

                    ,'left' //左对齐
                    ,'center' //居中对齐
                    ,'right' //右对齐
                    ,'link' //超链接
                    ,'unlink' //清除链接
                    ,'face' //表情
                ]
            }); //建立编辑器
        });





    });

</script>

